angular.module("my-integrat-service", [])

  .factory("IntegratServiceCtrl", function ($resource, $rootScope, ENV) {
    //获得服务器访问的路径
    //如果定义，不是用$符
    var APIUrl = ENV.api;

    var meHomeInfoResource = $resource(APIUrl + "my-integrat/getPointRule.do");

    var ruleListJson;


    //返回结果
    return {
      getIntegrat: function (memberId) {
        //使用post方法提交：
        meHomeInfoResource.save({
          member_id: memberId
        }, function (data) {
          ruleListJson = data;
          console.log(data);
          $rootScope.$broadcast("IntegratServiceCtrlUpdata");
        })
      },

      getRuleJson: function () {
        return ruleListJson;
      }
    }
  });
